﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using YYTmEditer.MtObject;

namespace YYTmEditer
{
    /// <summary>
    /// BlessingEditer.xaml 的交互逻辑
    /// </summary>
    public partial class BlessingEditer : Window
    {
        public BlessingEditer()
        {
            InitializeComponent();
        }
        private EditObject blessing;
        internal void SetBlessing(EditObject blessing)
        {
            this.blessing = blessing;
            this.Loaded += BlessingEditer_Loaded;

        }

        private void BlessingEditer_Loaded(object sender, RoutedEventArgs e)
        {
            this.blessing.load();
            textBName.Text = blessing.name;
            textBDesc.Text = blessing.desc;
        }

        void SaveEdit() {
            
            this.blessing.Save(textBName.Text,textBDesc.Text,this.comboBox.Text);
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            SaveEdit();
            this.Close();
        }
    }
}
